﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;
using System.Data;
using System.Configuration;


namespace DataLayer
{
    public class dlburndownchart
    {
        public DataSet myburndownchart(int sprintid)
        {
            string connStr = ConfigurationManager.ConnectionStrings["constring"].ConnectionString;
            string querystring = @"SELECT        TaskHistory.TimeStamp, SUM(TaskHistory.EstimatedWorkload - TaskHistory.RealWorkload) AS YValue
FROM            Tasks INNER JOIN
                         UserStory ON Tasks.UserStoryId = UserStory.UserStoryId INNER JOIN
                         Sprints ON UserStory.SprintID = Sprints.SprintId INNER JOIN
                         TaskHistory ON Tasks.TaskId = TaskHistory.TaskId
WHERE        (Sprints.SprintId = '" + sprintid + "') GROUP BY TaskHistory.TimeStamp";

            SqlConnection connection = new SqlConnection(connStr);
            SqlCommand querylogin = new SqlCommand(querystring, connection);

            SqlDataAdapter myadapter = new SqlDataAdapter(querylogin);
            DataSet mydataset = new DataSet();

            myadapter.Fill(mydataset);

            return mydataset;


        }


    }
}
